package tk.mynoteapp.dev.other.eliminateifelse.wrong.demo02;

public class MessageService {
    public String getMessage(int code) {
        if (code == 1) {
            return "成功";
        } else if (code == -1) {
            return "失败";
        } else if (code == -2) {
            return "网络超时";
        } else if (code == -3) {
            return "参数错误";
        }
        throw new RuntimeException("code错误");
    }
}
